import urllib.request
import json
# def saveDatas():
#     for x in range(1,33):
#         data = {"pagesize": 1000,
#         "pageindex": x,
#         "type": 2,
#         "txt1":"",
#         "CorpCode":"",
#         "CorpName":"",
#         "LegalMan":"",
#         "CertTypeNum":"",
#         "AreaCode":""}
#         data_string=urllib.parse.urlencode(data)
#         last_data=bytes(data_string,encoding='utf-8')
#         f = urllib.request.urlopen("http://61.190.70.122:8003/epoint-mini/rest/function/searchSNQY",data=last_data)
#         ltp_data = json.dumps(json.loads(f.read().decode('utf-8'))['all']['listinfo'])
#         
#         def save(filename, contents):
#               fh = open(filename, 'w', encoding='utf-8')
#               fh.write(contents)
#               fh.close()
#         save(f'/Users/wangshuguan/aa{x}.txt', ltp_data)
data = {"methodname": "GetCorpInfo",
        "CorpName": "公司",
        "CertType": "",
        "LegalMan":"",
        "CorpCode":"",
        "CorpName":"",
        "LegalMan":"",
        "CurrPageIndex":"2",
        "PageSize":"12"}
data_string=urllib.parse.urlencode(data)
last_data=bytes(data_string,encoding='utf-8')
f = urllib.request.urlopen("http://221.214.94.41:81/InformationReleasing/Ashx/InformationReleasing.ashx",data=last_data)
print(f.read().decode('utf-8'))
ltp_data = json.dumps(json.loads(f.read().decode('utf-8'))["data"]["CorpInfoList"])